﻿import React from 'react';
import { Timeline,Spin, Alert } from 'antd';
import classNames from 'classnames';
import { connect } from 'react-redux';
import { timeLineQuery } from '../../actions'

class OrderHistory extends React.Component {

	constructor(props){
		super(props);
	}

  componentWillMount () {
    console.log('StudentTimeLine.componentWillMount')
    this.props.dispatch(timeLineQuery.request()({}));
  }

	render() {
    let { timeLines, loading } = this.props;

    if (timeLines.length == 0) {
      return (
        <div style={{minHeight:560}}>
          <Alert
            message="提示"
            description="您还没有提交签约申请！"
            type="info"
            showIcon
          />
        </div>
      );
    }

		let container = (null);

    container = timeLines.map((timeLine) => {
      return (
          <Timeline.Item key={timeLine}>{timeLine}</Timeline.Item>
      );
    });

    return (
      <Spin spinning={loading}>
        <Timeline>
        {container}
          </Timeline>
      </Spin>
    );
	}
}

function mapStateToProps(state) {
  return {
    timeLines: state.order.timeLines,
    loading: state.order.loading,
  };
}

export default connect(mapStateToProps)(OrderHistory);
